version 14.2
clear
set more off

*     ****************************************************************  *
*     ****************************************************************  *
*       Filename:       pfp_8_analysis_WGI_addcontrols.do               *
*       Date:           06/03/2017                                      *
*       Author:         Felix Haass, Martin Ottmann                     *
*     ****************************************************************  *
*     ****************************************************************  *



// Alternative Model Specifications
// The omission of potentially influential independent variables from our regression 
// models constitutes another threat to the robustness of our findings. We therefore
// investigate whether the estimated effects remain stable in terms of statistical 
// significance and substantive effects when we control for different context factors. 
// Specifically, we control for non-linear effects of regime type, an alternative 
// fractionalization measure and additional power-sharing variables.



******* OVERVIEW *******
******* (1) load data *******
******* (2) OLS regressions with additional control variables *******
******* (3) Appendix Figure 4a: interaction b/w cabinetINC and WBnatres_ln *******
******* (4) Appendix Figure 4b: interaction b/w cabinetINC and aid_gdp_ln *******
******* (4) Appendix Figure 5a: interaction b/w cabinetINC and WBnatres_ln *******
******* (5) Appendix Figure 5b: interaction b/w cabinetINC and aid_gdp_ln *******
******* (6) Appendix Figure 6a: interaction b/w cabinetINC and WBnatres_ln *******
******* (7) Appendix Figure 6b: interaction b/w cabinetINC and aid_gdp_ln *******



******* (1) load data *******

use profits_from_peace_replication_dataset.dta, clear



******* (2) OLS regressions with additional control variables *******

local model1 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln ethnic polity2 polity2_squared"
local model2 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln ethnic polity2 polity2_squared cabXnatres"
local model3 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln ethnic polity2 polity2_squared cabXaid"
local model4 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln polity2 religion"
local model5 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln polity2 religion cabXnatres"
local model6 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln polity2 religion cabXaid"
local model7 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln ethnic polity2 tpsINC pce_proprepINC_ceil"
local model8 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln ethnic polity2 tpsINC pce_proprepINC_ceil cabXnatres"
local model9 "cabinetINC WBnatres_ln aid_gdp_ln WBDI_gdppc_ln WBDI_poptotal_ln ethnic polity2 tpsINC pce_proprepINC_ceil cabXaid"
forval i = 1/9 {
   quietly reg WGI_corrupt `model`i'' if pcy < 6, robust cluster(gwno)
   estimates store model`i'
 }
estout model1 model2 model3 model4 model5 model6 model7 model8 model9 ///
, cells(b(star fmt(2)) se(par fmt(2))) starlevels(* 0.1 ** 0.05 *** 0.01) stats(r2 r2_a N, fmt(2 2 0)) legend
// Appendix Table 5
esttab ///
model1 model2 model3 ///
using appendix_table_5.tex ///
, b(2) se(2) star(* 0.1 ** 0.05 *** 0.01) ///
stats(N r2_a, fmt(0 2) layout("\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}") labels(`"Observations"' `"Adjusted R\textsuperscript{2}"')) ///
title(OLS Regression Including Squared Polity2 Term) ///
mtitles("\specialcell{Model 1\\(Polity2 squared)}" "\specialcell{Model 2\\(Polity2 squared)}" "\specialcell{Model 3\\(Polity2 squared)}") ///
order(cabinetINC WBnatres_ln cabXnatres aid_gdp_ln cabXaid WBDI_gdppc_ln polity2 polity2_squared ethnic WBDI_poptotal_ln) ///
coeflabel(polity2 "Polity2" polity2_squared "Polity2 (squared)") ///
label nogaps nonumbers booktabs fragment ///
replace
// Appendix Table 6
esttab ///
model4 model5 model6 ///
using appendix_table_6.tex ///
, b(2) se(2) star(* 0.1 ** 0.05 *** 0.01) ///
stats(N r2_a, fmt(0 2) layout("\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}") labels(`"Observations"' `"Adjusted R\textsuperscript{2}"')) ///
title(OLS Regression Including Religion Fractionalization) ///
mtitles("\specialcell{Model 1\\(Rel. Frac.)}" "\specialcell{Model 2\\(Rel. Frac.)}" "\specialcell{Model 3\\(Rel. Frac.)}") ///
order(cabinetINC WBnatres_ln cabXnatres aid_gdp_ln cabXaid WBDI_gdppc_ln polity2 religion WBDI_poptotal_ln) ///
coeflabel(religion "Religious Fractionalization") ///
label nogaps nonumbers booktabs fragment ///
replace
// Appendix Table 7
esttab ///
model7 model8 model9 ///
using appendix_table_7.tex ///
, b(2) se(2) star(* 0.1 ** 0.05 *** 0.01) ///
stats(N r2_a, fmt(0 2) layout("\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}") labels(`"Observations"' `"Adjusted R\textsuperscript{2}"')) ///
title(OLS Regression Including Territorial Power-Sharing and Proportional Representation) ///
mtitles("\specialcell{Model 1\\(Additional\\PS Variables)}" "\specialcell{Model 2\\(Additional\\PS Variables)}" "\specialcell{Model 3\\(Additional\\PS Variables)}") ///
order(cabinetINC WBnatres_ln cabXnatres aid_gdp_ln cabXaid tpsINC pce_proprepINC_ceil WBDI_gdppc_ln polity2 ethnic WBDI_poptotal_ln) ///
coeflabel(tpsINC "Territorial Power-Sharing" pce_proprepINC_ceil "Proportional Representation") ///
label nogaps nonumbers booktabs fragment ///
replace



******* (3) Appendix Figure 4a: interaction b/w cabinetINC and WBnatres_ln *******

quietly ///
reg WGI_corrupt ///
i.cabinetINC##c.WBnatres_ln ///
c.polity2 c.WBDI_gdppc_ln c.WBDI_poptotal_ln c.ethnic c.polity2_squared ///
c.aid_gdp_ln ///
if pcy < 6, robust cluster(gwno)
quietly margins, dydx(cabinetINC) at(WBnatres_ln=(0(0.1)4.5) (mean)_c) vsquish
matrix b = r(b)'
matrix list b
matrix b = b[47...,1]
matrix list b
matrix at = r(at)
matrix list at
matrix at = at[1...,"WBnatres_ln"]
matrix list at
matrix v = r(V)
matrix list v
matrix v = v[47...,47...]
matrix list v
matrix se = vecdiag(cholesky(diag(vecdiag(v))))'
matrix list se
matrix d = at,b,se
matrix list d
svmat d, names(d)
generate ul = d2 + 1.96 * d3
generate ll = d2 - 1.96 * d3
clist d1-ll in 1/12
gen yline = 0
graph twoway ///
   (hist WBnatres_ln if pcy < 6, width(0.1) percent color(gs14) yaxis(2) ytitle("Percentage of Observations", axis(2))) ///
   (line d2 d1, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)) ///
   (line ul d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line ll d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line yline d1, clwidth(thin) clcolor(black) clpattern(solid)), ///
   xtitle("Natural Resource Wealth (ln)") ///
   ytitle("Conditional Marginal Effect of Executive PS", axis(1)) ///
   ylabel(-1(.5).5) ///
   xlabel(0(1)4.5) ///
   xsize(8) ysize(6) ///
   scheme(lean1) legend(off)
graph export appendix_figure_4a.pdf, replace
drop d1 d2 d3 ul ll yline



******* (4) Appendix Figure 4b: interaction b/w cabinetINC and aid_gdp_ln *******

quietly ///
reg WGI_corrupt ///
i.cabinetINC##c.aid_gdp_ln ///
c.polity2 c.WBDI_gdppc_ln c.WBDI_poptotal_ln c.ethnic c.polity2_squared ///
c.WBnatres_ln ///
if pcy < 6, robust cluster(gwno)
quietly margins, dydx(cabinetINC) at(aid_gdp_ln=(-11(0.2)1) (mean)_c) vsquish
matrix b = r(b)'
matrix list b
matrix b = b[62...,1]
matrix list b
matrix at = r(at)
matrix list at
matrix at = at[1...,"aid_gdp_ln"]
matrix list at
matrix v = r(V)
matrix list v
matrix v = v[62...,62...]
matrix list v
matrix se = vecdiag(cholesky(diag(vecdiag(v))))'
matrix list se
matrix d = at,b,se
matrix list d
svmat d, names(d)
generate ul = d2 + 1.96 * d3
generate ll = d2 - 1.96 * d3
clist d1-ll in 1/12
gen yline = 0
graph twoway ///
   (hist aid_gdp_ln if pcy < 6, width(0.3) percent color(gs14) yaxis(2) ytitle("Percentage of Observations", axis(2))) ///
   (line d2 d1, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)) ///
   (line ul d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line ll d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line yline d1, clwidth(thin) clcolor(black) clpattern(solid)), ///
   xtitle("Foreign Aid Income (ln)") ///
   ytitle("Conditional Marginal Effect of Executive PS", axis(1)) ///
   ylabel(-3(.5)1) ///
   xlabel(-11(2)1) ///
   xsize(8) ysize(6) ///
   scheme(lean1) legend(off)
graph export appendix_figure_4b.pdf, replace
drop d1 d2 d3 ul ll yline



******* (4) Appendix Figure 5a: interaction b/w cabinetINC and WBnatres_ln *******

quietly ///
reg WGI_corrupt ///
i.cabinetINC##c.WBnatres_ln ///
c.polity2 c.WBDI_gdppc_ln c.WBDI_poptotal_ln c.religion ///
c.aid_gdp_ln ///
if pcy < 6, robust cluster(gwno)
quietly margins, dydx(cabinetINC) at(WBnatres_ln=(0(0.1)4.5) (mean)_c) vsquish
matrix b = r(b)'
matrix list b
matrix b = b[47...,1]
matrix list b
matrix at = r(at)
matrix list at
matrix at = at[1...,"WBnatres_ln"]
matrix list at
matrix v = r(V)
matrix list v
matrix v = v[47...,47...]
matrix list v
matrix se = vecdiag(cholesky(diag(vecdiag(v))))'
matrix list se
matrix d = at,b,se
matrix list d
svmat d, names(d)
generate ul = d2 + 1.96 * d3
generate ll = d2 - 1.96 * d3
clist d1-ll in 1/12
gen yline = 0
graph twoway ///
   (hist WBnatres_ln if pcy < 6, width(0.1) percent color(gs14) yaxis(2) ytitle("Percentage of Observations", axis(2))) ///
   (line d2 d1, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)) ///
   (line ul d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line ll d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line yline d1, clwidth(thin) clcolor(black) clpattern(solid)), ///
   xtitle("Natural Resource Wealth (ln)") ///
   ytitle("Conditional Marginal Effect of Executive PS", axis(1)) ///
   ylabel(-1(.5).5) ///
   xlabel(0(1)4.5) ///
   xsize(8) ysize(6) ///
   scheme(lean1) legend(off)
graph export appendix_figure_5a.pdf, replace
drop d1 d2 d3 ul ll yline



******* (5) Appendix Figure 5b: interaction b/w cabinetINC and aid_gdp_ln *******

quietly ///
reg WGI_corrupt ///
i.cabinetINC##c.aid_gdp_ln ///
c.polity2 c.WBDI_gdppc_ln c.WBDI_poptotal_ln c.religion ///
c.WBnatres_ln ///
if pcy < 6, robust cluster(gwno)
quietly margins, dydx(cabinetINC) at(aid_gdp_ln=(-11(0.2)1) (mean)_c) vsquish
matrix b = r(b)'
matrix list b
matrix b = b[62...,1]
matrix list b
matrix at = r(at)
matrix list at
matrix at = at[1...,"aid_gdp_ln"]
matrix list at
matrix v = r(V)
matrix list v
matrix v = v[62...,62...]
matrix list v
matrix se = vecdiag(cholesky(diag(vecdiag(v))))'
matrix list se
matrix d = at,b,se
matrix list d
svmat d, names(d)
generate ul = d2 + 1.96 * d3
generate ll = d2 - 1.96 * d3
clist d1-ll in 1/12
gen yline = 0
graph twoway ///
   (hist aid_gdp_ln if pcy < 6, width(0.3) percent color(gs14) yaxis(2) ytitle("Percentage of Observations", axis(2))) ///
   (line d2 d1, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)) ///
   (line ul d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line ll d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line yline d1, clwidth(thin) clcolor(black) clpattern(solid)), ///
   xtitle("Foreign Aid Income (ln)") ///
   ytitle("Conditional Marginal Effect of Executive PS", axis(1)) ///
   ylabel(-3(.5)1) ///
   xlabel(-11(2)1) ///
   xsize(8) ysize(6) ///
   scheme(lean1) legend(off)
graph export appendix_figure_5b.pdf, replace
drop d1 d2 d3 ul ll yline



******* (6) Appendix Figure 6a: interaction b/w cabinetINC and WBnatres_ln *******

quietly ///
reg WGI_corrupt ///
i.cabinetINC##c.WBnatres_ln ///
c.polity2 c.WBDI_gdppc_ln c.WBDI_poptotal_ln c.ethnic i.tpsINC i.pce_proprepINC_ceil ///
c.aid_gdp_ln ///
if pcy < 6, robust cluster(gwno)
quietly margins, dydx(cabinetINC) at(WBnatres_ln=(0(0.1)4.5) (mean)_c tpsINC = 0 pce_proprepINC_ceil = 0) vsquish
matrix b = r(b)'
matrix list b
matrix b = b[47...,1]
matrix list b
matrix at = r(at)
matrix list at
matrix at = at[1...,"WBnatres_ln"]
matrix list at
matrix v = r(V)
matrix list v
matrix v = v[47...,47...]
matrix list v
matrix se = vecdiag(cholesky(diag(vecdiag(v))))'
matrix list se
matrix d = at,b,se
matrix list d
svmat d, names(d)
generate ul = d2 + 1.96 * d3
generate ll = d2 - 1.96 * d3
clist d1-ll in 1/12
gen yline = 0
graph twoway ///
   (hist WBnatres_ln if pcy < 6, width(0.1) percent color(gs14) yaxis(2) ytitle("Percentage of Observations", axis(2))) ///
   (line d2 d1, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)) ///
   (line ul d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line ll d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line yline d1, clwidth(thin) clcolor(black) clpattern(solid)), ///
   xtitle("Natural Resource Wealth (ln)") ///
   ytitle("Conditional Marginal Effect of Executive PS", axis(1)) ///
   ylabel(-1(.5).5) ///
   xlabel(0(1)4.5) ///
   xsize(8) ysize(6) ///
   scheme(lean1) legend(off)
graph export appendix_figure_6a.pdf, replace
drop d1 d2 d3 ul ll yline



******* (7) Appendix Figure 6b: interaction b/w cabinetINC and aid_gdp_ln *******

quietly ///
reg WGI_corrupt ///
i.cabinetINC##c.aid_gdp_ln ///
c.polity2 c.WBDI_gdppc_ln c.WBDI_poptotal_ln c.ethnic i.tpsINC i.pce_proprepINC_ceil ///
c.WBnatres_ln ///
if pcy < 6, robust cluster(gwno)
quietly margins, dydx(cabinetINC) at(aid_gdp_ln=(-11(0.2)1) (mean)_c tpsINC = 0 pce_proprepINC_ceil = 0) vsquish
matrix b = r(b)'
matrix list b
matrix b = b[62...,1]
matrix list b
matrix at = r(at)
matrix list at
matrix at = at[1...,"aid_gdp_ln"]
matrix list at
matrix v = r(V)
matrix list v
matrix v = v[62...,62...]
matrix list v
matrix se = vecdiag(cholesky(diag(vecdiag(v))))'
matrix list se
matrix d = at,b,se
matrix list d
svmat d, names(d)
generate ul = d2 + 1.96 * d3
generate ll = d2 - 1.96 * d3
clist d1-ll in 1/12
gen yline = 0
graph twoway ///
   (hist aid_gdp_ln if pcy < 6, width(0.3) percent color(gs14) yaxis(2) ytitle("Percentage of Observations", axis(2))) ///
   (line d2 d1, clpattern(solid) clwidth(medium) clcolor(black) yaxis(1)) ///
   (line ul d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line ll d1, clpattern(shortdash) clwidth(thin) clcolor(black)) ///
   (line yline d1, clwidth(thin) clcolor(black) clpattern(solid)), ///
   xtitle("Foreign Aid Income (ln)") ///
   ytitle("Conditional Marginal Effect of Executive PS", axis(1)) ///
   ylabel(-3(.5)1) ///
   xlabel(-11(2)1) ///
   xsize(8) ysize(6) ///
   scheme(lean1) legend(off)
graph export appendix_figure_6b.pdf, replace
drop d1 d2 d3 ul ll yline
